#ifndef GLYPH_H
#define GLYPH_H
#include "Point.h"
#include "FontFace.h"
namespace FT
{
typedef FT_Bitmap_ GlyphGenericBitmap;
/**
 * @brief The AbstractGlyph class. Defines base parameters and methods for glyph.
 * Glyph graphical representation must be defined in derived classes.
 */
class BaseGlyph
{
public:
    BaseGlyph(uint index, Point advance, Point horisontalBearing, FontFace &face, GlyphGenericBitmap &genericBitmap):
        index(index),advance(advance),horisontalBearing(horisontalBearing),face(face)
    {
    }
    virtual ~BaseGlyph(){}

    uint getIndex()
    {
        return index;
    }

    Point getAdvance()
    {
        return advance;
    }

    Point getHoriBearing()
    {
        return horisontalBearing;
    }

    Point getKerning(BaseGlyph &prevGlyph, uint kernMode = FT_KERNING_DEFAULT)
    {
        FT_Vector  delta;
        FT_Get_Kerning(face.face, prevGlyph.getIndex(), index, kernMode, &delta);
        return Point(delta.x >> 6,delta.y >> 6);
    }
private:
    uint index;
    Point advance;
    Point horisontalBearing;
    FontFace &face;
};
}
#endif // GLYPH_H
